﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BackGroundRoll : MonoBehaviour
{
    public GameObject[] bgs;

    int activeBG = 0;

    public float speed;

    private void Update()
    {
        bgs[0].transform.position += new Vector3(Time.deltaTime * speed, 0, 0);
        bgs[1].transform.position += new Vector3(Time.deltaTime * speed, 0, 0);
        foreach(GameObject bg in bgs)
        {
            if (bg.transform.position.x > 38f)
            {
                bg.transform.position = new Vector3(-38f, 0, 0);
            }
        }
    }
}
